package ooDay03;

public class PolymorficDemo {
    public static void main(String[] args) {



//        Dog dog = new Dog("小黑",1,"黑");
//        Animal anDog = dog;//new Dog("小黑",1,"黑");
//        Swim swDog = dog;//new Dog("小黑",1,"黑");
//        anDog.eat();
//        swDog.swim();
//
//        Fish fish = new Fish("小金",1,"金");
//        Animal anFish = fish;
//        anFish.eat();
//
//        //多态的第一种应用
//
//        Master master = new Master();
//        master.feed(fish);
//        master.feed(anFish);
//
//        //多态的第二种
//        Animal[] animals = new Animal[5];
//        animals[0] = dog;
//        animals[1] = new Dog("小黄",2,"黄");
//        animals[2] = fish;
//        animals[3] = new Fish("小金",1,"金");
//        animals[4] = new Chick("小花",1,"花");
//        for (int i =0;i<animals.length;i++){
//            System.out.println(animals[i].name);
//            animals[i].eat();
//            animals[i].drink();
//        }


        //强转

    }
}
